import { Define, EntityObjectFactory } from 'tiny-entity2';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');
import { PaymentChannel } from './paymentChannel';

@Define.Table({ TableName: "payment" })
export class Payment extends EntityObjectType<Payment> {
    @Define.PrimaryKey()
    id: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    name: string;

    @Define.Column({
        DataType: Define.DataType.INT,
        DataLength: 2,
        DefaultValue: 0,
        NotAllowNULL: true
    })
    status: number;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    })
    paymentChannelId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    backgroundColor: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    icon: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    description: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    })
    storeId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    groupName: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    couponId: string;

    @Define.Column({
        DataType: Define.DataType.INT,
        DefaultValue: 0
    })
    indexNo: number;

    @Define.Column({
        DataType: Define.DataType.Decimal,
        DefaultValue: 100,
        DecimalPoint: 3
    })
    ratio: number;

    @Define.Column({
        DataType: Define.DataType.BOOL
    })
    ratioEditDisable: boolean;

    /**
     * 是否在界面中显示（不显示表示是内部支付方式）
     *
     * @type {boolean}
     * @memberof Payment
     */
    @Define.Column({
        DataType: Define.DataType.BOOL
    })
    hide: boolean;

    @Define.Column({
        DataType: Define.DataType.BOOL
    })
    isSystem: boolean;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    createTime: number;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    version: number;

    @Define.Mapping({
        Mapping: 'PaymentChannel',
        MappingKey: { FKey: 'channelId', MKey: 'paymentChannelId' },
        MappingType: Define.MappingType.One
    })
    paymentChannel: PaymentChannel;
}

export const PromotionStatus = {
    Enable: 'enable',
    Disable: 'disable'
}